#include<bits/stdc++.h>

using namespace std;
//stack FILO (First In Last  Out)
int data[1000], top = -1;//stack
//1 2 3 4 5 依次进栈
//重复输出栈顶元素 直到栈为空
//栈的常见操作

//1. 初始化空栈init  top=-1
//2. 进栈 push data[++top]=x;
//3. 出栈 pop  data[top--];
//4. 查询栈顶（不弹出) data[top]

int main() {
    data[++top] = 1;//1进栈
    data[++top] = 2;//2进栈
    data[++top] = 3;//3进栈
    data[++top] = 4;//4进栈
    data[++top] = 5;//5进栈

    while (top != -1) {
        cout << data[top--] << " ";

    }

    return 0;
}